#!/bin/sh

################################################################################
##                                                                            ##
## Copyright (c) International Business Machines  Corp., 2005                 ##
##                                                                            ##
## This program is free software;  you can redistribute it and#or modify      ##
## it under the terms of the GNU General Public License as published by       ##
## the Free Software Foundation; either version 2 of the License, or          ##
## (at your option) any later version.                                        ##
##                                                                            ##
## This program is distributed in the hope that it will be useful, but        ##
## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
## for more details.                                                          ##
##                                                                            ##
## You should have received a copy of the GNU General Public License          ##
## along with this program;  if not, write to the Free Software               ##
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
##                                                                            ##
##                                                                            ##
################################################################################
#
# File:
#   check_setkey
#
# Description:
#   Check the local/remote host has setkey command
#
# Arguments:
#   None
#
# Returns:
#   0: Both host have setkey command
#   1: One or both host doesn't have setkey command
#
# Author:
#   Mitsuru Chinen <mitch@jp.ibm.com>
#
# History:
#   Oct 19 2005 - Created (Mitsuru Chinen)
#
#-----------------------------------------------------------------------
#Uncomment line below for debug output.
#trace_logic=${trace_logic:-"set -x"}
$trace_logic


# Make sure the value of LTPROOT
LTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`}
export LTPROOT

# Check the environmanet variable for the test
. check_envval || exit 1

which setkey >/dev/null 2>&1
if [ $? -ne 0 ]; then
    echo "The local host does not have setkey command"
    exit 1
fi

ret=`$LTP_RSH $RHOST 'PATH=/sbin:/usr/sbin:$PATH which setkey >/dev/null 2>&1 ; echo $?'`
if [ $ret -ne 0 ]; then
    echo "The remote host does not have setkey command"
    exit 1
fi
